home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / XPK / Developer / Include / C / xpk / xpkprefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-05  |  4.5 KB  |  139 lines

  1. #ifndef XPK_XPKPREFS_H
  2. #define XPK_XPKPREFS_H
  3.  
  4. /*
  5. **    $VER: xpk/xpkprefs.h 4.10 (05.04.97) by SDI
  6. **
  7. **    (C) Copyright 1996-1997 by Dirk Stöcker
  8. **        All Rights Reserved
  9. */
  10.  
  11. #include <exec/semaphores.h>
  12. #include <libraries/iffparse.h>
  13.  
  14. #define ID_XPKT  MAKE_ID('X','P','K','T')
  15. #define ID_XPKM  MAKE_ID('X','P','K','M')
  16.  
  17. /***************************************************************************
  18.  *
  19.  *
  20.  *     XpkTypeData structure
  21.  *
  22.  */
  23.  
  24. #define XTD_NoPack        (1<<0)    /* filetype should not be crunched */
  25. #define XTD_ReturnError        (1<<1)    /* return XPKERR_BADPARAMS -- this
  26.                        equals version 3 handling */
  27. /* These two cannot be set same time! */
  28.  
  29. struct XpkTypeData {
  30.   ULONG  xtd_Flags;       /* see above XTD flags */
  31.   ULONG  xtd_StdID;       /* holding the ID --> 'NUKE' */
  32.   ULONG  xtd_ChunkSize;    /* maybe useless with external crunchers */
  33.   UWORD  xtd_Mode;       /* PackMode */
  34.   UWORD  xtd_Version;       /* structure version --> 0 at the moment */
  35.   STRPTR xtd_Password;       /* not used at the moment */
  36.   STRPTR xtd_Memory;       /* memory pointer - when should be freed by */
  37.   ULONG  xtd_MemorySize;   /* memory size    - receiver (xpkmaster) */
  38. };
  39.  
  40. /***************************************************************************
  41.  *
  42.  *
  43.  *     XpkTypePrefs structure
  44.  *
  45.  */
  46.  
  47. #define XPKT_NamePattern    (1<<0)    /* File Pattern is given */
  48. #define XPKT_FilePattern    (1<<1)  /* Name Pattern is given */
  49. /* These can both be set (in loading this means File AND Name Pattern have
  50. to match), but one is needed */
  51.  
  52. struct XpkTypePrefs {
  53.   ULONG         xtp_Flags;     /* See above XPKT Flags */
  54.   STRPTR         xtp_TypeName;     /* Name of this file type (for prefs program) */
  55.   STRPTR         xtp_NamePattern; /* Pointer to NamePattern */
  56.   STRPTR         xtp_FilePattern; /* Pointer to FilePattern */
  57.   struct XpkTypeData *    xtp_PackerData;
  58. };
  59.  
  60. /***************************************************************************
  61.  *
  62.  *
  63.  *     XpkMainPrefs structure
  64.  *
  65.  */
  66.  
  67. #define XPKM_UseXFD        (1<<0)    /* Use xfdmaster.library for unpacking */
  68. #define XPKM_UseExternals    (1<<1)    /* Use xex libraries */
  69. #define XPKM_AutoPassword    (1<<2)    /* Use the automatic password requester */
  70.  
  71. struct XpkMainPrefs {
  72.   ULONG            xmp_Version;     /* version of structure ==> 0 */
  73.   ULONG            xmp_Flags;     /* above defined XPKM flags */
  74.   struct XpkTypeData *    xmp_DefaultType; /* sets the mode used as default */
  75.   UWORD            xmp_Timeout;     /* Timeout for password requester
  76.                  given in seconds, zero means no timeout */
  77. };
  78.  
  79. /* The library internal defaults are:
  80.   XPKM_UseXFD            FALSE
  81.   XPKM_AutoPassword        FALSE
  82.   XPKM_UseExternals        TRUE
  83.   XTD_ReturnError        defined as default
  84.   xmp_TimeOut            set to 120    (two minutes)
  85.  
  86. These defaults are used, when no preferences file is given.
  87. */
  88.  
  89. /***************************************************************************
  90.  *
  91.  *
  92.  *     XpkMasterPrefs Semaphore structure
  93.  *
  94.  *  find with FindSemaphore(XPKPREFSSEMNAME);
  95.  *
  96.  *  obtain with ObtainSemaphoreShared(),
  97.  *  programs WRITING into the structure fields must know:
  98.  *    - use ObtainSemaphore() instead of ObtainSemaphoreShared()
  99.  *    - free memory of elements you remove
  100.  *    - xb_MainPrefsSize is the length of memory allocated for xb_MainPrefs
  101.  *    - all other nodes are freed, when XpkMasterPrefs program finishes, do
  102.  *    not do it your own, but you have to allocate memory for new ones!
  103.  *  Generally there should be no need to write to these fields !!!!
  104.  */
  105.  
  106. #define XPKPREFSSEMNAME        "« XpkMasterPrefs »"
  107.  
  108. /* Defines used for xps_PrefsType. These help to find out, which preferences
  109.  * type is used. */
  110.  
  111. #define XPREFSTYPE_STANDARD    0x58504B4D    /* 'XPKM' */
  112. #define XPREFSTYPE_CYB        0x20435942    /* ' CYB' */
  113.  
  114. struct XpkPrefsSemaphore {
  115.   struct SignalSemaphore     xps_Semaphore;
  116.   ULONG                xps_Version;       /* at the moment 0 */
  117.   ULONG                xps_PrefsType;       /* preferences type */
  118.   APTR                xps_PrefsData;       /* preferences data */
  119.   struct XpkMainPrefs *        xps_MainPrefs;     /* defined defaults */
  120.   ULONG                xps_RecogSize;       /* needed size of Recogbuffer */
  121.   struct XpkTypeData * ( *    xps_RecogFunc) (); /* Recog function */
  122.   struct Hook *            xps_ProgressHook;  /* hook function */
  123.   struct Task *            xps_MasterTask;       /* Creater's task */
  124. };
  125.  
  126. /* Use Signal(sem->xps_MasterTask, SIGBREAKF_CTRL_C); to get the installer
  127.    program to remove the semaphore. */
  128.  
  129. /* prototype/typedef of RecogFunc:
  130. typedef struct XpkTypeData * __asm (*RecogFunc)
  131.     (register __a0 STRPTR buffer,
  132.      register __a1 STRPTR filename,
  133.      register __a2 STRPTR chunkname,
  134.      register __d0 ULONG  buffersize,
  135.      register __d1 ULONG  fullsize);
  136. */
  137.  
  138. #endif /* XPK_XPKPREFS_H */
  139.